package com.huaxin.hxmoduleworkorder.dto.request;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 新增巡查工单请求 DTO
 * <p>
 * 对应实体类：InspectionOrder
 * 用于接收前端提交的巡查工单创建数据。
 * 所有字段命名与实体类完全一致，确保映射准确。
 * </p>
 *
 * @author [你的名字或团队]
 * @since 2025-09-02
 */
@Data
@Accessors(chain = true)
public class InspectionOrderCreateReqDTO {
    @Schema(description = "工单标题", example = "月度客户用电安全巡检")
    @Size(max = 100, message = "工单标题长度不能超过100个字符")
    @NotBlank(message = "工单标题不能为空")
    private String title;

    @Schema(description = "工单描述", example = "对所有签约客户进行例行安全检查")
    @Size(max = 1000, message = "工单描述长度不能超过1000个字符")
    private String description;

    @Schema(description = "执行开始时间（可联系客户）", example = "2025-09-02T08:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime executeStartTime;

    @Schema(description = "执行截止时间（必须完成）", example = "2025-09-05T18:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime executeEndTime;

    @Schema(description = "负责电工ID", example = "e1001")
    @NotBlank(message = "负责电工ID不能为空")
    private String assignedElectricianId;

    @Schema(description = "负责电工名称", example = "张三")
    private String assignedElectricianName;

    @Schema(description = "涉及客户ID列表", example = "")
    private List<InspectionOrderCustomerIdDTO> customers;

    @TableField(value = "template_id")
    @Schema(description = "使用的巡查模板ID", example = "tpl_ins_001")
    private String templateId;
}